package com.atguigu.realtime.function;

import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;

/**
 * Created by GodRUI on 2021/7/5 19:29
 */
@FunctionHint(output = @DataTypeHint("row<source string,ct bigint>"))
public class KwProduct extends TableFunction<Row> {

    public void eval(Long click_ct,Long order_ct,Long cart_ct){

        if (click_ct > 0 ){
            collect(Row.of("click",click_ct));
        }

        if (order_ct > 0 ){
            collect(Row.of("order",order_ct));
        }

        if (cart_ct > 0 ){
            collect(Row.of("cart",cart_ct));
        }

    }
}
